package org.jeecg.modules.demo.crm.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.crm.entity.CTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 任务功能
 * @Author: jeecg-boot
 * @Date:   2025-06-16
 * @Version: V1.0
 */
public interface CTaskMapper extends BaseMapper<CTask> {

    @Select("select count(*) from c_task where processing_status!='完成' and  sub_project_id =#{subProjectId}" )
    Integer unfinished(@Param("subProjectId") String subProjectId);

    @Select("select count(*) from c_task where   sub_project_id =#{subProjectId}" )
    Integer subProjectCount(@Param("subProjectId") String subProjectId);

    @Select("select * from c_task where processing_status ='待处理' or processing_status ='驳回'  AND ( create_time >= DATE_SUB(NOW(), INTERVAL 1 DAY)OR update_time >= DATE_SUB(NOW(), INTERVAL 1 DAY))")
    List<CTask> taskPending();

    @Select("select * from c_task where processing_status ='已处理' AND ( create_time >= DATE_SUB(NOW(), INTERVAL 1 DAY)OR update_time >= DATE_SUB(NOW(), INTERVAL 1 DAY)) ")
    List<CTask> taskProcessed();
}
